package com.gzweipu.wcard;

import android.app.Activity;
import android.app.ActivityGroup;
import android.os.Bundle;
import android.widget.TabHost;

public class BaseTabContentActivity extends AbstractAsyncActivity {
     
	private String subTitle;

	public String getSubTitle() {
		return subTitle;
	}

	public void setSubTitle(String subTitle) {
		this.subTitle = subTitle;
		
		HomeActivity homeActivity=null;
		 
		if(getParent() instanceof HomeActivity){
			homeActivity= (HomeActivity)getParent(); 
		}
		else{
			if (getParent() != null) {
				if (getParent().getParent() != null) {
					Activity p = getParent().getParent();
					homeActivity = (HomeActivity) (p);
				}
			}
		}
		if(subTitle!=null)
			if(homeActivity!=null)
				homeActivity.tvTitle.setText(subTitle);
	}
	
	private TabHost tabHost;
	
	
	public TabHost getTabHost() {
		return tabHost;
	}

	public void setTabHost(TabHost tabHost) {
		this.tabHost = tabHost;
		 
	}
	
	private HomeActivity homeActivity;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
	 
		 
		if(getParent() instanceof HomeActivity){
			homeActivity= (HomeActivity)getParent(); 
		}
		else{
			if (getParent() != null) {
				if (getParent().getParent() != null) {
					Activity p = getParent().getParent();
					homeActivity = (HomeActivity) (p);
				}
			}
		}
		if(subTitle!=null)
			if(homeActivity!=null)
				homeActivity.tvTitle.setText(subTitle);
	 
	}
	
	   public HomeActivity getThisParent(){
	    	 return homeActivity;
	    }
	
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume(); 
	 
		if(getParent() instanceof HomeActivity){
			homeActivity= (HomeActivity)getParent(); 
		}
		else{
			if (getParent() != null) {
				if (getParent().getParent() != null) {
					Activity p = getParent().getParent();
					homeActivity = (HomeActivity) (p);
				}
			}
		}
		if(subTitle!=null)
			if(homeActivity!=null)
				homeActivity.tvTitle.setText(subTitle);
 
		
		
	}
}
